<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="me.yobol.greentable.commons.path.*" %>
<%@ page import="me.yobol.greentable.bean.DishesBean" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>Dishes List</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">

  </head>
  
	<body>
	<%
		List<DishesBean> dishes = (List<DishesBean>)request.getSession().getAttribute("dishes_list");
		int flag = (request.getAttribute("flag") == null) ? -1 : (Integer)request.getAttribute("flag");
		int dishesOwner = (request.getSession().getAttribute("uId") == null) ? -1 : (Integer)request.getSession().getAttribute("uId");
	%>
		菜谱：<br/>
	<%
		if(!dishes.isEmpty()){
			for(DishesBean d : dishes){
	%>
				<a href="<%=SPath.sGetDishes(request,"?dishesId=" + d.getDishesId()) %>">
					<%=d.getDishesName() %> : <%=d.getDishesDescription() %>
				</a>
				<%
					if(flag == 1 && dishesOwner == d.getDishesOwner()){
				%>
					&nbsp;&nbsp;<a href="<%=PPath.pModifyDishes(request,"?dishesId=" + d.getDishesId()) %>">修改</a>
					&nbsp;&nbsp;<a href="<%=SPath.sDeleteDishes(request,"?dishesId=" + d.getDishesId() + "&dishesOwner=" + dishesOwner) %>">删除</a>
				<%
					}
				%>
				<br/>
	<%
			}
		}
	%>
  </body>
</html>
